from flask import Flask,flash, request, redirect, url_for
from werkzeug.utils import secure_filename
import os

ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
# requests-toolbelt 是支持的支持数据流
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = '/path/to/the/uploads'


@app.route('/')
def hello_world():
    return 'Hello, Worl1111大d!'

# 设置http的方法


@app.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        print('使用的是post方法')

# 定义文件上传


@app.route('/upload', methods=['GET', 'POST'])
def upload_file():
    # 开始处理上传的文件
    print('开始处理文件')
    if request.method == 'POST':
        f = request
        print(f)
        # f.save('/uploads/' + secure_filename(f.filename))
# def upload():
#     print('收到文件啦')
#     return '收到啦'
